Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum


  

PreviousPrevious NextNext


~Vijay Brefreegenetsi 25.Jun.03 09:41 PM a Web browser
Applications Development 6.0.1 Windows 2000


Hi,

I am very new to Java. I have written an Agent that hangs the client. I am attempting to display a dialog box. The dialog box appears, however, the client then hangs.

Any ideas what could be causing the hang?

Here is the code:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import lotus.domino.*;

public class ExUserClassify extends AgentBase
{
// Construction

// Attributes
Session curSession;
AgentContext curAgentContext;
Database curDatabase;
Database colDatabase;
Document curDocument;
DocumentCollection curCollection;
String strFileName;

// Operations
public void NotesMain()
{
int i;

try
{
// Get current Session
curSession = getSession();

// Get current AgentContext
curAgentContext = curSession.getAgentContext();

DlgSetup sdSetup = new DlgSetup();
}
catch(Exception e)
{
e.printStackTrace();
}
}

// Implementation
}

class DlgSetup
{
DlgSetup()
{
dialog = new CodeChooser();

dialog.showDialog(null, "Select Classification Code");
}

private CodeChooser dialog = null;
}

class CodeChooser extends JPanel
{
CodeChooser()
{
setLayout(new BorderLayout());

// Construct the panel with our controls.

JPanel panel = new JPanel();
panel.setLayout(new FlowLayout());

label = new JLabel("Select code:");

cb = new JComboBox();
cb.setEditable(true);

// For now, just add items.

cb.addItem("Gwynn");
cb.addItem("McGwire");
cb.addItem("Bonds");
cb.addItem("Ruth");

panel.add(label);
panel.add(cb);

add(panel, BorderLayout.CENTER);

// Create the Ok and Cancel buttons.

JButton okButton = new JButton("Ok");
okButton.addActionListener(
new ActionListener()
{
public void actionPerformed(ActionEvent event)
{
ok = true;
dialog.setVisible(false);
}
}
);

JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(
new ActionListener()
{
public void actionPerformed(ActionEvent event)
{
dialog.setVisible(false);
}
}
);

// Add buttons to another panel on the southern border.

JPanel buttonPanel = new JPanel();
buttonPanel.add(okButton);
buttonPanel.add(cancelButton);
add(buttonPanel, BorderLayout.SOUTH);
}

public boolean showDialog(Component parent, String title)
{
ok = false;

// Locate the owner frame.

Frame owner = null;
if (parent instanceof Frame)
owner = (Frame)parent;
else
owner = (Frame)SwingUtilities.getAncestorOfClass(Frame.class, parent);

owner = null;
dialog = new JDialog(owner, true);
dialog.getContentPane().add(this);
dialog.pack();

dialog.setTitle(title);
dialog.show();
return ok;
}

private JLabel label;
private JComboBox cb;
private boolean ok;
private JDialog dialog;
}

Any help on this is much appreciated. I have spent a long time trying to figure out what's going on.

Thanks,
- Michael








  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Category
Platform
Release
Advanced search

 RSS feedsRSS
All forum posts RSS
All main topics RSS